package com.foxzzz.str;


public class Solution1309 {

    public String freqAlphabets(String s) {
        if (s == null) {
            return null;
        }
        StringBuilder sb = new StringBuilder();
        char[] chars = s.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            int value = chars[i];

            // 1-2 情况
            if (value > 48 && value < 51 && chars.length - i > 2 && chars[i + 2] == 35) {
                sb.append((char) ((chars[i] - 48) * 10 + (chars[i + 1] - 48) + 96));
                i = i + 2;
            } else if (value != 35) {
                sb.append((char) ((int) chars[i] + 48));
            }

        }
        return sb.toString();
    }

    public static void main(String[] args) {
        Solution1309 solution1309 = new Solution1309();
        System.out.println(solution1309.freqAlphabets("12345678910#11#12#13#14#15#16#17#18#19#20#21#22#23#24#25#26#"));
        System.out.println(solution1309.freqAlphabets("10#11#12"));
        System.out.println(solution1309.freqAlphabets("1326#"));


    }
}
